package com.ftg.learn.chapter12;

import java.util.HashMap;
import java.util.Map;

/**
 * 学习一个冲突的解决 方案问题
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/2/14 上午9:41
 */
public class LearnMap03 {

    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("3Qj","a");
        map.put("2pj","a");
        map.put("2qK","a");
        map.put("2r,","a");
        map.put("3RK","a");
        map.put("3S,","a");
        map.put("42j","a");
        map.put("43K","a");
        map.put("44,","a");
        map.put("Ea","aaa");
        map.put("FB","aaa");
//        [Node[]] + [Node(hash,k,v,next)] + []
//        table[12] = new Node(2236,"Ea","aaa",null);
//        table[12] = new Node(2236,"FB","aaa",null);
        //冲突 hashcode 相同 ， 数据丢失... jdk1.8
        System.out.println("Ea".hashCode() & 15);
        System.out.println("Ea".hashCode() & 16);

//        同一个桶下面的所有链式存储结构里面的节点，它们有可具有相同的hashcode 他们的hashcode与上长度返回的结果是相同的
//        https://blog.csdn.net/namelij/article/details/120009578
//        https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
//        https://blog.csdn.net/qq_44918090/article/details/119966525
    }


}
